/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package activeRecord;

import activeRecord.newdb.db;
import buslog.Event;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author degrave
 */
public class eventActiveRecord {
    
    public static Event findEvent(String date,String time) {
        try {
            Connection c = db.getInstance().getConnection();
            java.sql.Statement s = c.createStatement ();
            ResultSet rs = s.executeQuery ("select * from EVENTS where DATE = '" + date +"' AND TIME = '" + time +"'" );
            rs.next();
            Event event = new Event(rs.getInt(1), rs.getString(2),rs.getString(3),rs.getString(4),rs.getInt(5));
            return event;        
        } 
        catch (SQLException ex) {
            Logger.getLogger(activeRecord.eventActiveRecord.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
        
    }
}
